package zyc.java.project.springbootprojectweb.dao.impl;

import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.CharsetUtil;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import zyc.java.project.springbootprojectweb.dao.UserDao;

import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

@Repository
public class UserDaoImpl implements UserDao {
    @Override
    public List<String> findAll() {
        InputStream inputStream = UserDaoImpl.class.getClassLoader().getResourceAsStream("user.txt");
        ArrayList<String> list = IoUtil.readLines(inputStream, StandardCharsets.UTF_8, new ArrayList<>());

        return list;
    }
}
